<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<title>查看日志列表</title>
		<!-- css代码 start -->
		<link href="../../../css/mui.min.css" rel="stylesheet" />
		<link href="../../../css/global.css" rel="stylesheet" />
		<link href="../../../css/style.css" rel="stylesheet" />
		<link href="../../../css/checkbox.css" rel="stylesheet" />
		<style type="text/css">
			.item_box .item .text span {
				width: 100%;
				display: flex;
			}
			.item_box .item .text span .txt-overflow{
				flex: 1;
				overflow: hidden;
				text-overflow: ellipsis;
				white-space: nowrap;
			}
			.lolwidth{
				float: left;
				width: 135px;
			}
		</style>
		<!-- css代码 end -->
	</head>
	<body>
		<!-- html代码 start -->
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 id="title" class="mui-title">查看日志列表</h1>
		</header>
		<div class="mui-content">
			<div class="page_cen shadow title_num" id="dianji">服务通知编号：<span id="serviceNo" style="color: #ea1e1a;"></span></div>
			<div class="item_box" id="itemBox">
				<!-- <div class="item">
					<div class="text">
						<span><img src="../../../images/icon_77.png" /><div class="lolwidth">到达现场时间：</div>2020-05-14 19：16</span>
					</div>
					<div class="text">
						<span><img src="../../../images/icon_78.png" /><div class="lolwidth">工作开始时间：</div>2020-05-14 19：16</span>
					</div>
					<div class="text">
						<span><img src="../../../images/icon_79.png" /><div class="lolwidth">工作结束时间：</div>2020-05-14 19：16</span>
					</div>
					<div class="text">
						<span><img src="../../../images/icon_76.png" /><div class="lolwidth">工作内容：</div>哈哈哈哈</span>
					</div>
				</div> -->
			</div>
		</div>
		<!-- html代码 end -->

		<!-- js代码 start -->

		<!-- 基础js start -->
		<script src="../../../js/mui.min.js"></script>
		<script src="../../../js/utils/h.js"></script>
		<script src="../../../js/constant.js"></script>
		<script src="../../../js/common.js"></script>
		<script src="../../../js/utils/base64.js"></script>
		<script src="../../../js/utils/md5.js"></script>
		<script src="../../../js/utils/sortMap.js"></script>
		<script src="../../../js/utils/http.js"></script>
		<script src="../../../js/app.js"></script>
		<!-- 基础js end -->

		<script type="text/javascript" charset="utf-8">
			var serviceNo;
			var sendTime;
			(function($, doc) {
				$.init();

				$.plusReady(function() {
					var self = plus.webview.currentWebview();
					serviceNo = self.serviceNo;
					sendTime = self.sendTime;
					h("#serviceNo").html(serviceNo);
					selectList();
				});
			}(mui, document));

			// 查询派单列表
			function selectList() {
				var fseId = app.getUser().enginnerId;
				ajaxPost(BASE_URL + "cc/ServiceLog/selectServiceLogList", {
					"serviceNo": serviceNo,
					"fseId": fseId
				}, function(data) {
					// console.log(JSON.stringify(data))
					// 无数据
					if (data.data.length == 0) {
						h("#itemBox").html('<div class="nodata">—— 暂无数据 ——</div>');
						return false;
					}
					// 显示列表
					if (data.code === 200) {
						if (data.data && data.data.length > 0 ) {
							var str = '';
							for (var i = 0; i < data.data.length; i++) {
								var info = data.data[i];
								str += '<div class="item" onclick="jumpToNext(\'' + info.id + '\')">';
								str += '<div class="text">';
								str += '<span><img src="../../../images/icon_202.png" /><div class="lolwidth">到达现场时间：</div>' + info.arriveTime + '</span> ';
								str += '</div>';
								str += '<div class="text">';
								str += '<span><img src="../../../images/icon_202.png" /><div class="lolwidth">工作开始时间：</div>' + info.startTime + '</span> ';
								str += '</div>';
								str += '<div class="text">';
								str += '<span><img src="../../../images/icon_202.png" /><div class="lolwidth">工作结束时间：</div>' + info.endTime + '</span> ';
								str += '</div>';
								str += '<div class="text">';
								str += '<span><img src="../../../images/icon_218.png" /><div class="lolwidth">工作内容：</div>';
								var content = info.workContent == "undefiend" || info.workContent == null ? "" : info.workContent;
								str += '<div class="txt-overflow">'+ content + '</div></span>';
								str += '</div>';
								var isRelatedReport = !info.reportId || info.reportId == '' ? "未关联" : '已关联';
								str += '<div class="text">';
								str += '<span><img src="../../../images/icon_224.png"/><div class="lolwidth">是否关联服务报告：</div>';
								str += isRelatedReport + '</span>';
								str += '</div></div>';
							}
							h('#itemBox').html(str);
						} else {
							html = '<div class="nodata">—— 暂无数据 ——</div>';
							h("#itemBox").html(html);
						}
					} else {
						h("#itemBox").html('<div class="nodata">—— 暂无数据 ——</div>');
						app.toast(data.msg)
					}
				}, function(errorMsg) {
					h("#itemBox").html('<div class="nodata">—— 暂无数据 ——</div>');
					app.toast("数据获取失败，请检查网络连接");
				});
			}

			// 跳转下一页
			function jumpToNext(id) {
				app.jumpTo("/view/service/serviceLog/logEdit.html", "view/service/serviceLog/logEdit", {
					"logId": id,
					"sendTime": sendTime,
					"pageName": "noticeLogList"
				})
			}
			h("#dianji").tap(function(){
				app.jumpTo("/view/workArea/service/serveDetails.html", "view/workArea/service/serveDetails.html", {
					"serviceNo": serviceNo,
					"enginnerId": app.getUser().enginnerId
				})
			})
		</script>
		<!-- js代码 end -->
	</body>
</html>
